package com.qiang.test01;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class Demo01 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        /*MyThread mt = new MyThread();
        //mt.run();
        MyThread mt2 = new MyThread();
        //mt2.run();
        mt.start();
        mt2.start();*/
        //MyRunnable mr = new MyRunnable();
       /* Thread th = new Thread(mr);
        th.start();
        th.setName("飞机");
        Thread th2 = new Thread(mr);
        th2.setName("坦克");
        th2.start();*/
        /*Thread th1 = new Thread(mr, "飞机飞机");
        Thread th2 = new Thread(mr, "坦克");
        th1.start();
        th2.setDaemon(true);
        th2.start();*/

        MyCallable mc = new MyCallable();
        FutureTask<String> sf = new FutureTask<>(mc);
        //FutureTask<Object> sf = new FutureTask<Object>(mc);
        Thread th = new Thread(sf);
        th.start();
        String o = sf.get();
        System.out.println(o);
    }
}
